package com.chanshuyi.dao.mapper;

import com.chanshuyi.model.SysCode;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface SysCodeMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table SysCode
     *
     * @mbggenerated Wed Jul 12 20:57:03 CST 2017
     */
    @Delete({
        "delete from SysCode",
        "where codeId = #{codeId,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer codeId);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table SysCode
     *
     * @mbggenerated Wed Jul 12 20:57:03 CST 2017
     */
    @Insert({
        "insert into SysCode (codeId, codeTypeId, ",
        "codeName, parentCodeId)",
        "values (#{codeId,jdbcType=INTEGER}, #{codeTypeId,jdbcType=INTEGER}, ",
        "#{codeName,jdbcType=VARCHAR}, #{parentCodeId,jdbcType=INTEGER})"
    })
    int insert(SysCode record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table SysCode
     *
     * @mbggenerated Wed Jul 12 20:57:03 CST 2017
     */
    @InsertProvider(type=SysCodeSqlProvider.class, method="insertSelective")
    int insertSelective(SysCode record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table SysCode
     *
     * @mbggenerated Wed Jul 12 20:57:03 CST 2017
     */
    @Select({
        "select",
        "codeId, codeTypeId, codeName, parentCodeId",
        "from SysCode",
        "where codeId = #{codeId,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="codeId", property="codeId", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="codeTypeId", property="codeTypeId", jdbcType=JdbcType.INTEGER),
        @Result(column="codeName", property="codeName", jdbcType=JdbcType.VARCHAR),
        @Result(column="parentCodeId", property="parentCodeId", jdbcType=JdbcType.INTEGER)
    })
    SysCode selectByPrimaryKey(Integer codeId);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table SysCode
     *
     * @mbggenerated Wed Jul 12 20:57:03 CST 2017
     */
    @UpdateProvider(type=SysCodeSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(SysCode record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table SysCode
     *
     * @mbggenerated Wed Jul 12 20:57:03 CST 2017
     */
    @Update({
        "update SysCode",
        "set codeTypeId = #{codeTypeId,jdbcType=INTEGER},",
          "codeName = #{codeName,jdbcType=VARCHAR},",
          "parentCodeId = #{parentCodeId,jdbcType=INTEGER}",
        "where codeId = #{codeId,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(SysCode record);
}